package com.itbaizhan.controller;

import jakarta.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.SessionAttributes;

@Controller
@RequestMapping("/c4")
@SessionAttributes("name")
public class MyController4 {

    @RequestMapping("/anno1")
    public String anno1(Model model){
        model.addAttribute("name","cuixuefei");
        return "baizhan";
    }

    @RequestMapping("/anno2")
    public String anno2(HttpSession session){
        Object name = session.getAttribute("name");
        System.out.println(name);
        return "baizhan";
    }
}
